﻿@{
    ViewBag.Title = "CategoryDetail";
}

<div id="cphMain_ctl00_ContentPane" class="center">
    <div id="Breadcrumb" class="Breadcrumb">
        <ul>
            <li class="first">
                <a href='javascript:;' onclick="javascript:loadAction('Index2','Main')">Trang chủ
                </a>
            </li>
            <li>
                <a href='javascript:;' onclick="javascript:loadAction('CategoryList','Admin')">Danh sách công ty</a>
            </li>
            <li>
                <span>Thông tin công ty</span>
            </li>
        </ul>
    </div>

<div class="Account-Module DefaultModule">
    
<div class="DefaultModule LoginForm Block">
    <span style="display: none;">
        </span>
    <div id="CreateAccountForm" class="Block Moveable Panel CreateAccountForm">
        
        <div id="cphMain_ctl00_ctl01_ctl00_pnlInfo">
	
            <div class="BlockContent">
                <div class="defaultTitle LoginForm-title">
                    <h1>
                        Thông tin công ty
                    </h1>
                </div>
                <form action="/Admin/CategoryDetailClick" method="post" onsubmit="return categoryDetailValidation();" enctype="multipart/form-data" >
                <div class="defaultContent LoginForm-content CreateAccountContainer">                    
                    <h3>Thông tin bắt buộc</h3>
                    <div class="FormContainer HorizontalFormContainer NarrowFormContainer">
                        <dl>
                            @if(Model.ID > 0)
                            {
                            <dt>
                                <span class="required">*</span> ID:
                            </dt>
                            <dd>
                                <input name="cateID" type="text" value="@Model.ID"
                                    id="cateID" class="NormalTextBox" readonly="true" 
                                    style="width:100px;">                                                                    
                            </dd>
                            }
                            <dt>
                                <span class="required">*</span> Tên công ty:
                            </dt>
                            <dd>
                                <input name="cateName" type="text" value="@Model.name"
                                    id="cateName" class="NormalTextBox" 
                                    style="width:200px;">                                                                    
                            </dd>
                            <dt>
                                <span class="required">*</span> Địa chỉ:
                            </dt>
                            <dd>
                                <input name="address" type="text" value="@Model.address"
                                    id="address" class="NormalTextBox" 
                                    style="width:300px;">                                                                    
                            </dd>
                            <dt>
                                <span class="required">*</span> Số điện thoại:
                            </dt>
                            <dd>
                                <input name="phoneNum" type="text" value="@Model.phone_number"
                                    id="phoneNum" class="NormalTextBox" 
                                    style="width:200px;">                                                                    
                            </dd>


                            @if(Model.image_link != null)
                            {
                            <dt></dt>             
                            <dd> 
                                <img src="/Content/data/images/categories/@Model.image_link" height="300" id="blah"/>
                            </dd>
                            }else
                            {
                                <dt></dt>             
                                <dd> 
                                <img id="blah" src="#" alt="your image" style="display:none;" height="300"/>
                            </dd>
                            }
                            <dt><span class="required">*</span> Hình ảnh:</dt>
                            <dd>                                
                                <input name="image_link" type="file" id="image_link" class="NormalTextBox" 
                                    style="width:250px;" accept="image/*">                                                                
                            </dd>                         
                                 
                            <dt>
                                <span class="required">*</span> Mô tả công ty:
                            </dt>
                            <dd>
                                <textarea name="description" 
                                    id="description" class="NormalTextBox" 
                                    style="width:420px; height:300px">@Model.description</textarea>                                                                    
                            </dd>                                           
                            
                        </dl>
                    </div>
                    <p>
                    </p>
                    <h3>
                        Thông tin không bắt buộc
                    </h3>
                    
                    <div class="FormContainer HorizontalFormContainer NarrowFormContainer">
                        <dl>                            
                            <dt>
                                Email:
                            </dt>
                            <dd>
                                <input name="email" type="text" value="@Model.email"
                                    id="email" class="NormalTextBox" 
                                    style="width:200px;">                                                                    
                            </dd>
                            <dt>
                                Website:
                            </dt>
                            <dd>
                                <input name="website" type="text" value="@Model.website"
                                    id="website" class="NormalTextBox" 
                                    style="width:200px;">                                                                    
                            </dd>
                            
                            <dt>&nbsp;</dt>
                            <dd>
                                <input type="submit" name="btnSubmit" value="Cập nhật công ty"                                     
                                    class="CreateAccountButton">                                                                
                            </dd>
                        </dl>
                    </div>
                    <p>
                    </p>
                </div>
                    </form>
                <div class="defaultFooter LoginForm-footer"><div></div></div>
            </div>
        
</div>
    </div>
</div>    


<script type="text/javascript">
    
    //preview hinh anh sau khi chon file
    (function ($) {
        function readURL(input) {
            var $prev = $('#blah');

            if (input.files && input.files[0]) {
                var reader = new FileReader();

                reader.onload = function (e) {
                    $prev.attr('src', e.target.result);
                    
                }

                reader.readAsDataURL(input.files[0]);

                $prev.show();
            } else {
                $prev.hide();
            }
        }

        $('#image_link').on('change', function () {
            readURL(this);
        });
    })(jQuery);
        
</script>
</div>
</div>
